feat(debugger): handle terminal covenant transitions with non-covenant outputs#114
Open
atl4so wants to merge 1 commit intokaspanet:covpp-reset2from
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The synthesized output state collection in
debugger/cli/src/main.rsincludedoutputs without covenant binding, e.g. plain P2PK outputs. For terminal
covenant transitions following the singleton lowering pattern, this caused
next_statesto have synthesized non-zero length, breakingrequire(next_states.length == 0)at script execution.This patch filters synthesized output states by
output_covenant_id.is_some(),ensuring only covenant-bound outputs contribute to the synthesized
next_statesarray passed to the user policy function.
Motivation
Singleton covenant patterns commonly use terminal transitions where the user
policy function returns an empty
State[]- releasing locked funds to a P2PKrecipient with no continuing covenant state.
Without this fix, JSON-driven test fixtures for these patterns produce script
execution failures at the length check, even though the fixture correctly
describes a terminal transition with no covenant outputs. The failure
originates earlier in CLI output state synthesis but surfaces at the
length assertion.
Reference:
silverscript-lang/tests/covenant_declaration_ast_fixtures/lowers_singleton_sugar_transition_termination_allowed_two_field_state.silTesting
cargo test -p cli-debuggerAdded a regression test covering a singleton terminal transition with a plain
P2PK output: the JSON fixture executes the release path and reaches the
terminal length check correctly with
next_states.length == 0.27/27 CLI tests pass (was 26, +1 new regression test).